/**
 * 登录后的主页面
 */
Divo.app.Main = function() {
	/* ----------------------- private变量 ----------------------- */
	var oHotelList, oBookingList, oChangePasswordForm;
	var hotelGrid, bookingGrid;

	/* ----------------------- private方法 ----------------------- */
	function createLayout() {

		Ext.apply(bookingGrid, {
			title : 'Booking Detail',
			region : 'south',
			border : false,
			split : true,
			height : 150,
			collapsible : true
		});

		var layout = new Ext.Panel( {
			title : 'Hotel List',
			layout : 'border',
			width : 547,
			border : false,
			height : 380,
			items : [bookingGrid, hotelGrid]
		});
		layout.render('sidebar');
	}
	
	//修改密码
	function onChangePassword() {
		oChangePasswordForm.showDialog();
	}

	/* ----------------------- public方法 ----------------------- */
	return {

		// 初始化
		init : function() {
			oChangePasswordForm = Divo.app.ChangePasswordForm;

			oHotelList = Divo.app.HotelList;
			oHotelList.init();
			hotelGrid = oHotelList.getGrid();

			oBookingList = Divo.app.BookingList;
			oBookingList.init();
			bookingGrid = oBookingList.getGrid();

			createLayout();
			oHotelList.showGrid();
			oBookingList.showGrid();

			Ext.get('settings').on('click', function() {
				onChangePassword();
			});
			
			Divo.endLoading();
		}

	}; // return

}();

Ext.onReady(Divo.app.Main.init, Divo.app.Main, true);

// EOP

